<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        //闰年判断
        function isRun(year){
            var res = year % 400 == 0 || (year%4==0 && year%100 !=0);
            return res;
        }      
        var year = Number(prompt("请输入年"))
        var month = Number(prompt("请输入月"))
        var day = Number(prompt("请输入日"))
        function caculateDate(year,month,day){
        //1.年月日
  

        var sumDay = 0;
        //2.计算距离1990年1月1日间隔的总天数
        //3.整年的累加
        for(var i = 1990;i< year;i++){
            sumDay+=365;
            if(isRun(year)){
                sumDay+=1;
            }
        }
        //4.当年整月的累加
        for(var j = 1;j<month;j++){
            switch(j){
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                    sumDay += 31;
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                    sumDay+=30;
                    break;
                case 2:
                    sumDay += 28;
                    if(isRun(year)){
                        sumDay += 1;
                    }
            }
        }
        //5.累加当前月的天数
        sumDay += day;

        //6.判断星期[0-6]
        var week = sumDay % 7;
        var show = "";
        switch(week){
            case 0:show="周日";break;
            case 1:show="周一";break;
            case 2:show="周二";break;
            case 3:show="周三";break;
            case 4:show="周四";break;
            case 5:show="周五";break;
            case 6:show="周六";break;

        }
        console.log(year+"年"+month+"月"+day+"日是:"+show)
        }
    </script>
</head>
<body>
    
    <button>caculateDate(year,month,day)</button> 
</body>
</html>